import staticRouters from "./staticRouter";
import {App} from 'vue'
import {RouteRecordName, RouteRecordRaw, createRouter,createWebHistory} from 'vue-router'
let routers=[...staticRouters]
const router = createRouter({
    history:createWebHistory(),
    routes:routers
})
export function addrouter(parentRouter:RouteRecordName,route:RouteRecordRaw){
    if(parentRouter===null){
        router.addRoute(route)
    }
    else{
        router.addRoute(parentRouter,route)
    }
}
export function setupRouter(app: App) {
    app.use(router);
}